INTERFACE zif_peng_azoai_sdk_comp_files
  PUBLIC .
*  INTERFACES zif_peng_azoai_sdk_component .
* https://learn.microsoft.com/en-us/rest/api/cognitiveservices/azureopenaistable/files


  "! <p class="shorttext synchronized" lang="en">Deletes the file</p>
  "! Deletes the file with the given file-id. Deletion is also allowed if a file was used,
  "! e.g., as training file in a fine-tune job.
  "! @parameter fileid | <p class="shorttext synchronized" lang="en">The identifier of the file.</p>
  "! @parameter statuscode | <p class="shorttext synchronized" lang="en">Status Code</p>
  "! @parameter statusreason | <p class="shorttext synchronized" lang="en">Status Description</p>
  "! @parameter json | <p class="shorttext synchronized" lang="en">JSON string with information about operation</p>
  "! @parameter error | <p class="shorttext synchronized" lang="en">ABAP Ready error details</p>
  "! @raising zcx_peng_azoai_sdk_exception | <p class="shorttext synchronized" lang="en"></p>
  METHODS delete
    IMPORTING
      fileid       TYPE string
    EXPORTING
      statuscode   TYPE i
      statusreason TYPE string
      json         TYPE string
      error        TYPE zif_peng_azoai_sdk_types=>ty_error
    RAISING
      zcx_peng_azoai_sdk_exception .

  "! <p class="shorttext synchronized" lang="en">Gets details for a single file</p>
  "! Gets details for a single file specified by the given file-id including status, size, purpose, etc.
  "! @parameter fileid | <p class="shorttext synchronized" lang="en">The identifier of the file.</p>
  "! @parameter statuscode | <p class="shorttext synchronized" lang="en">Status Code</p>
  "! @parameter statusreason | <p class="shorttext synchronized" lang="en">Status Description</p>
  "! @parameter json | <p class="shorttext synchronized" lang="en">JSON string with information about operation</p>
  "! @parameter file | <p class="shorttext synchronized" lang="en">ABAP Ready File Information</p>
  "! @parameter error | <p class="shorttext synchronized" lang="en">ABAP Ready error details</p>
  "! @raising zcx_peng_azoai_sdk_exception | <p class="shorttext synchronized" lang="en"></p>
  METHODS get
    IMPORTING
      fileid       TYPE string
    EXPORTING
      statuscode   TYPE i
      statusreason TYPE string
      json         TYPE string
      file         TYPE zif_peng_azoai_sdk_types=>ty_file_get
      error        TYPE zif_peng_azoai_sdk_types=>ty_error
    RAISING
      zcx_peng_azoai_sdk_exception .

  "! <p class="shorttext synchronized" lang="en">Gets the content of the file specified by the given file-id</p>
  "! Gets the content of the file specified by the given file-id. Files can be
  "! user uploaded content or generated by the service like result metrics of a fine-tune job.
  "! @parameter fileid | <p class="shorttext synchronized" lang="en">The identifier of the file.</p>
  "! @parameter statuscode | <p class="shorttext synchronized" lang="en">Status Code</p>
  "! @parameter statusreason | <p class="shorttext synchronized" lang="en">Status Description</p>
  "! @parameter content | <p class="shorttext synchronized" lang="en">Content of the file</p>
  "! @parameter error | <p class="shorttext synchronized" lang="en">ABAP Ready error details</p>
  "! @raising zcx_peng_azoai_sdk_exception | <p class="shorttext synchronized" lang="en"></p>
  METHODS get_content
    IMPORTING
      fileid       TYPE string
    EXPORTING
      statuscode   TYPE i
      statusreason TYPE string
      content      TYPE string
      error        TYPE zif_peng_azoai_sdk_types=>ty_error
    RAISING
      zcx_peng_azoai_sdk_exception .


  "! <p class="shorttext synchronized" lang="en">Creates new file by importing data from a provided url</p>
  "! Creates a new file entity by importing data from a provided url. Uploaded files can,
  "! for example, be used for training or evaluating fine-tuned models.
  "! @parameter import_info | <p class="shorttext synchronized" lang="en">Import Information</p>
  "! @parameter statuscode | <p class="shorttext synchronized" lang="en">Status Code</p>
  "! @parameter statusreason | <p class="shorttext synchronized" lang="en">Status Description</p>
  "! @parameter json | <p class="shorttext synchronized" lang="en">JSON string with information about operation</p>
  "! @parameter file | <p class="shorttext synchronized" lang="en">ABAP Ready File Information</p>
  "! @parameter error | <p class="shorttext synchronized" lang="en">ABAP Ready error details</p>
  "! @raising zcx_peng_azoai_sdk_exception | <p class="shorttext synchronized" lang="en"></p>
  METHODS import
    IMPORTING
      import_info  TYPE zif_peng_azoai_sdk_types=>ty_file_import
    EXPORTING
      statuscode   TYPE i
      statusreason TYPE string
      json         TYPE string
      file         TYPE zif_peng_azoai_sdk_types=>ty_file_get
      error        TYPE zif_peng_azoai_sdk_types=>ty_error
    RAISING
      zcx_peng_azoai_sdk_exception .


  "! <p class="shorttext synchronized" lang="en">Gets a list of all files</p>
  "! Gets a list of all files. These include user uploaded content like files
  "! with purpose "fine-tune" for training or validation of fine-tunes models as
  "! well as files that are generated by the service such as "fine-tune-results"
  "! which contains various metrics for the corresponding fine-tune job.
  "! @parameter statuscode | <p class="shorttext synchronized" lang="en">Status Code</p>
  "! @parameter statusreason | <p class="shorttext synchronized" lang="en">Status Description</p>
  "! @parameter json | <p class="shorttext synchronized" lang="en">JSON string with information about operation</p>
  "! @parameter filelist | <p class="shorttext synchronized" lang="en">ABAP Ready list of files</p>
  "! @parameter error | <p class="shorttext synchronized" lang="en">ABAP Ready error details</p>
  "! @raising zcx_peng_azoai_sdk_exception | <p class="shorttext synchronized" lang="en"></p>
  METHODS list
    EXPORTING
      statuscode   TYPE i
      statusreason TYPE string
      json         TYPE string
      filelist     TYPE zif_peng_azoai_sdk_types=>ty_file_list
      error        TYPE zif_peng_azoai_sdk_types=>ty_error
    RAISING
      zcx_peng_azoai_sdk_exception .

  "! <p class="shorttext synchronized" lang="en">Creates a new file entity by uploading data</p>
  "! Creates a new file entity by uploading data from SAP Application Server. Uploaded files can, for example,
  "! be used for training or evaluating fine-tuned models.
  "! @parameter filename | <p class="shorttext synchronized" lang="en">Name of file if upload is successful</p>
  "! @parameter jsonldata | <p class="shorttext synchronized" lang="en">JSONL data to upload</p>
  "! @parameter statuscode | <p class="shorttext synchronized" lang="en">Status Code</p>
  "! @parameter statusreason | <p class="shorttext synchronized" lang="en">Status Description</p>
  "! @parameter json | <p class="shorttext synchronized" lang="en">JSON string with information about operation</p>
  "! @parameter file |<p class="shorttext synchronized" lang="en">ABAP Ready file information</p>
  "! @parameter error | <p class="shorttext synchronized" lang="en">ABAP Ready error details</p>
  "! @raising zcx_peng_azoai_sdk_exception | <p class="shorttext synchronized" lang="en"></p>
  METHODS upload
    IMPORTING
      filename     TYPE string
      jsonldata    TYPE zif_peng_azoai_sdk_types=>tty_file_upload
    EXPORTING
      statuscode   TYPE i
      statusreason TYPE string
      json         TYPE string
      file         TYPE zif_peng_azoai_sdk_types=>ty_file_get
      error        TYPE zif_peng_azoai_sdk_types=>ty_error
    RAISING
      zcx_peng_azoai_sdk_exception .


ENDINTERFACE.
